<template>
  <el-config-provider :locale="locale">
    <NuxtLayout>
      <!-- <NuxtWelcome /> -->
      <NuxtPage />
    </NuxtLayout>
  </el-config-provider>
</template>

<script setup lang="ts">
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import en from 'element-plus/dist/locale/en.mjs';
import DevicePixelRatio from '@/utils/DevicePixelRatio.js';
// import silence from "@/utils/mouse";

// silence.init({
//   type: 11,
//   color: "rgba(187,67,128,1)"
// })
const isDark = useDark();

const bodyScale = () => {
  var devicewidth = document.documentElement.clientWidth;//获取当前分辨率下的可是区域宽度
  var scale = devicewidth / 1920; // 分母——设计稿的尺寸
  document.body.style.zoom = scale;//放大缩小相应倍数
}
onMounted(() => {
  bodyScale()
  new DevicePixelRatio().init();
})

const language = ref('zh-cn');
const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en));
import { ElMessage } from 'element-plus';
onErrorCaptured((error) => {
  console.error(error);
  useErrorTip(error.message);
  ElMessage({
    // title: 'Error',
    message: h('p', {}, error.message),
    type: 'error',
    appendTo: '#__nuxt',
  });
  return false;
});
</script>
